
#ifndef _debug_INCLUDED_
#define _debug_INCLUDED_

//
// Workaround for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34734
//
#ifdef PROGMEM
#undef PROGMEM
#define PROGMEM __attribute__((section(".progmem.data")))
#endif

//extern "C" {

extern void usart0_init (void);
//extern void debug_printf (const char * format, ...);
//extern void debug_printf (PGM_P format, ...);
extern void ASSERT (const char * file, int line);

extern void assertBlink(int n);

//extern void vApplicationMallocFailedHook(void);
extern void vApplicationTaskSwitchHook (int task);
extern void vApplicationTraceMallocHook (void *addr, size_t size);
extern void vApplicationTaskDelayHook (void);

//}

//#define PRINTF(format, ...) debug_printf(PSTR(format), ## __VA_ARGS__)
//#define PRINTF(format, ...) debug_printf(PSTR(format), ...)
#define PRINTF(format, ...) do { noInterrupts(); printf_P(PSTR(format), ## __VA_ARGS__); interrupts(); } while(0)

#endif // _debug_INCLUDED_
